package com.CMS.server.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.CMS.server.domain.Images;

public class ImagesDao extends BaseDao<Images>{
	
	public ImagesDao()
	{
		super();
	}
	
	
	@SuppressWarnings("unchecked")
	public List<Images> getAllImages(long idGalery){
		EntityManager em = entityManager();
		List<Images> lista = null;
		try
		{
			Query q = em.createQuery("select i from Images i where i.galery.id = ?1");
			      q.setParameter(1,idGalery);
			
			lista = q.getResultList();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
		finally{
			em.close();
		}
		
		return lista;
	}

}
